home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c
- Path: phcoms4.seri.philips.nl!panther!baynes
- From: baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes)
- Subject: Re: Binary Mode stdin/stdout
- Sender: news@ukpsshp1.serigate.philips.nl (account for localnews)
- Message-ID: <DMI28r.5Lr@ukpsshp1.serigate.philips.nl>
- Date: Fri, 9 Feb 1996 08:29:14 GMT
- References: <4f67kg$11g@cortex.dialin.rrze.uni-erlangen.de> <DME74w.4M4@stdc.demon.co.uk> <4fbk81$qk@cortex.dialin.rrze.uni-erlangen.de>
- Organization: Philips Semiconductors, Southampton, UK
- X-Newsreader: TIN [version 1.2 PL2]
-
- Markus Kuhn (mskuhn@unrza3.dialin.rrze.uni-erlangen.de) wrote:
- : clive@stdc.demon.co.uk (Clive D.W. Feather) writes:
-
- : >In article <4f67kg$11g@cortex.dialin.rrze.uni-erlangen.de>,
- : >Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de> wrote:
- : >> Why isn't there a standard way of allowing an ISO C program to switch
- : >> the standard input and output into binary transparent mode (as with
- : >> the "b" flag in fopen()/freopen() for normal files)?
- : >>
- : >> Has this just been forgotten or is there a good technical reason?
-
- : >On some implementations, this decision has to be made at the time you
- : >open the file and can't be changed.
-
- : I would already be happy with a portable function that allows to
- : switch stdin or stdout to binary mode and that has only a well-defined
- : behaviour according to the standard if this switch occurs before any
- : byte has been written to or read from the stream. This would cause no
- : headaches on your computing fossil (because inserting a newline during
- : a later switch would not be non-conforming) and would be sufficient
- : for all important applications I can think of (like zcat).
-
- You make an assumption that the operating system provides you with a means
- of directing binary data into stdin or recieving it from stdout in the first
- place. There is nothing to stop an operating system from insisting that
- stdin and stdout are conly onnected to a text terminal. If you are writing
- truely portable code then you would be better to not expect too much from
- the OS.
-
- [On the other hand I agree it would be useful to switch the mode though one
- would have to accept it might fail or be useless - but almost anything to do
- with stdin and stdout can fail or be useless so that is not a bit deal.
- However there are plenty of other things to do with files that would be useful
- such as switching from readonly to readwrite and truncating an already open
- file.]
-
- --
- Stephen Baynes baynes@mulsoc2.serigate.philips.nl
- Philips Semiconductors Ltd
- Southampton My views are my own.
- United Kingdom
-